<template>
    <div class="waiting-queue-index">
        <div class="process-handling-card">
            <a-tabs type="card" default-active-key="1" v-model:activeKey="activeKey">
                <a-tab-pane key="等待队列" tab="等待队列"> </a-tab-pane>
                <a-tab-pane key="提前办理过" tab="提前办理过"> </a-tab-pane>
            </a-tabs>
        </div>
        <div v-show="activeKey == '等待队列'" class="waiting-content-v">
            <commpVxeTable
            :occupancyHeight="62"
            :isCanWrap="true"
            :config="dataTableConfig" 
            :columns="columnsVxe" 
            :formItem="formItem"
            ref="acceptanceRegistrationRef"
            >
                <template v-slot:fsxmc_name="{row}" data-desc="自定操作栏">
                    <span v-if="row.fzwxtbzzt == '补正中'" class="fsxmcQ-c-t">[{{ row.fzwxtbzzt}}]</span>
                    <span v-if="row.fzwxtbzzt == '已补正'" class="fsxmcQ-l-t">[{{ row.fzwxtbzzt}}]</span>

                    <span v-if="row.fzwxtzgzt == '整改中'" class="fsxmcQ-c-t">[{{ row.fzwxtzgzt }}]</span>
                    <span v-if="row.fzwxtzgzt == '已整改'" class="fsxmcQ-l-t">[{{ row.fzwxtzgzt }}]</span>

                    <span v-if="row.fzwxtcjzt == '撤件回复'" class="fsxmcQ-h-t" @click="cjhfClick()">[{{ row.fzwxtcjzt }}]</span>
                    <span v-if="row.fzwxtcjzt == '撤件审核中'" class="fsxmcQ-c-t">[{{ row.fzwxtcjzt }}]</span>
                    <span v-if="row.fzwxtcjzt == '已撤件'" class="fsxmcQ-l-t">[{{ row.fzwxtcjzt }}]</span>

                    <span v-if="row.fzwxtthzt" class="fsxmcQ-h-t">{{ row.fzwxtthzt }}</span>
                    <a href="#" @click="viewingMattersClick(row)">{{ row.fsxmc }}</a>
                </template>
                <template v-slot:operation_btn="{row}">
                    <a-form layout="inline" class="search-form" >
                        <a-form-item >
                            <a-button class="blue-btn" type="primary" @click="advanceHandle(row)">提前办</a-button>
                        </a-form-item>
                    </a-form>
                </template>
            </commpVxeTable>
        </div>
        <div v-show="activeKey == '提前办理过'" class="waiting-content-v">
            <commpVxeTable
            :occupancyHeight="62"
            :isCanWrap="true"
            :config="advanceConfig" 
            :columns="advancecolumnsVxe" 
            :formItem="advanceformItem"
            ref="acceptanceRegistrationRef"
            >
                <template v-slot:fsxmc_name="{row}" data-desc="自定操作栏">
                    <span v-if="row.fzwxtbzzt == '补正中'" class="fsxmcQ-c-t">[{{ row.fzwxtbzzt}}]</span>
                    <span v-if="row.fzwxtbzzt == '已补正'" class="fsxmcQ-l-t">[{{ row.fzwxtbzzt}}]</span>

                    <span v-if="row.fzwxtzgzt == '整改中'" class="fsxmcQ-c-t">[{{ row.fzwxtzgzt }}]</span>
                    <span v-if="row.fzwxtzgzt == '已整改'" class="fsxmcQ-l-t">[{{ row.fzwxtzgzt }}]</span>

                    <span v-if="row.fzwxtcjzt == '撤件回复'" class="fsxmcQ-h-t" @click="cjhfClick()">[{{ row.fzwxtcjzt }}]</span>
                    <span v-if="row.fzwxtcjzt == '撤件审核中'" class="fsxmcQ-c-t">[{{ row.fzwxtcjzt }}]</span>
                    <span v-if="row.fzwxtcjzt == '已撤件'" class="fsxmcQ-l-t">[{{ row.fzwxtcjzt }}]</span>

                    <span v-if="row.fzwxtthzt" class="fsxmcQ-h-t">{{ row.fzwxtthzt }}</span>
                    <a href="#" @click="viewingMattersClick(row)">{{ row.fsxmc }}</a>
                </template>
                
            </commpVxeTable>
        </div>
        <handlingOpinions ref="handlingOpinionsRef" @getInputOpinion="getInputOpinion"/>
    </div>
</template>
<script>
import assessCheckApi from './service/api'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import blobType from '@/common/blobType'
import moment from 'moment'
import {spcyUpdateKbJobInBkb} from './service/index'
import {
    queryJobByJobIdServe,
    getSqsxBm,
} from './service/index'
export default {
    components:{
        commpVxeTable,
    },
    props:{

    },
    data(){
        return{
            activeKey:'等待队列',
            formItem:[{
                label: '事项名称',
                model: 'fsxmc',
            },{
                label: '企业名称',
                model: 'fqymc',
            },{
                label: '申请单号',
                model: 'fsqdbh',
            },{
                label: '发送人',
                model: 'ffsrmc',
            },{
                label: '剩余天数',
                model: 'syday',
            },{
                label: '发送时间',
                model: ['slkssj','sljssj'],
                type:'rangePicker',
                format:'YYYY-MM-DD'
            }],
            columnsVxe:[{ 
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '事项名称', //列头显示文字
                field: 'fsxmc',
                align:'left',
                // slots: {
                //     default: 'fsxmc_name',
                // },
            },{
                title: '企业名称', //列头显示文字
                field: 'fqymc',
                align:'left',
            },{
                title: '申请单号',
                field: 'fsqdbh',
            },{
                title: '发送人',
                field: 'ffsrmc',
                width:90,
            },{
                title: '发送时间',
                field: 'ffssj',
                width:145,
            },{
                title: '剩余天数',
                field: 'syday',
                width:75,
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                fixed: 'right',
                width:100,
            }],
            dataTableConfig:{
                api: assessCheckApi.list,
                rowId: 'jobid',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                paramet:{
                    // onlyCurrentUser:false,
                    // fblzt:'待办'
                    flcsfkb:'不可办',
                }
            },
            advanceConfig:{
                api: assessCheckApi.list,
                rowId: 'jobid',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                paramet:{
                    flcsfkb:'提前办',
                    // onlyCurrentUser:false,
                    // fblzt:'待办'
                }
            },
            
            advanceformItem:[{
                label: '事项名称',
                model: 'fsxmc',
            },{
                label: '企业名称',
                model: 'fqymc',
            },{
                label: '申请单号',
                model: 'fsqdbh',
            },{
                label: '剩余天数',
                model: 'syday',
            },{
                label: '当前环节',
                model: 'fhjmc',
                placeholder: '环节名称',
                type:'Select',
                dictionaryType:'查验流程环节名称'
            },{
                label: '当前办理人',
                model: 'fdbr',
            },{
                label: '发送时间',
                model: ['slkssj','sljssj'],
                type:'rangePicker',
                format:'YYYY-MM-DD'
            }],
            advancecolumnsVxe:[{ 
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '事项名称', //列头显示文字
                field: 'fsxmc',
                align:'left',
                // slots: {
                //     default: 'fsxmc_name',
                // },
            },{
                title: '企业名称', //列头显示文字
                field: 'fqymc',
                align:'left',
            },{
                title: '申请单号',
                field: 'fsqdbh',
            },{
                title: '任务编号',
                field: 'fslbh',
            },{
                title: '发送时间',
                field: 'ffssj',
                width:145,
            },{
                title: '剩余天数',
                field: 'syday',
                width:75,
            },{
                title: '当前环节',
                field: 'fhjmc',
            },{
                title: '当前办理人',
                field: 'fdbr',
            },{
                title: '备注',
                field: 'fbz',
            }],
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        cjhfClick(){
            this.$route.push('/enterpriseWithdrawalApplication/index')
        },
        timeProcessing(val){
            if(val){
                val = val.slice(0,11)
            }
            return val
        },
        advanceHandle(val){
            //console.log(val)
            this.$refs.handlingOpinionsRef.getData({title:'提前办理',opinionType:'提前办理意见',isJudgeAfterClosing:false,valueData:{jobid:val.jobid}})
            this.$refs.handlingOpinionsRef.visible = true
        },
        getInputOpinion(val,row){
            this.$refs.handlingOpinionsRef.confirmLoadinghandle(true)
            spcyUpdateKbJobInBkb({fbz:val,jobid:row.jobid}).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.$refs.handlingOpinionsRef.visible = false
                    this.$refs.handlingOpinionsRef.confirmLoadinghandle(false)
                }else{
                    this.$message.warning(res.message)
                    this.$refs.handlingOpinionsRef.confirmLoadinghandle(false)
                }
            })
        },
    }
}
</script>
<style lang="less">
.waiting-queue-index{
    background: #fff;
    .waiting-content-v{
        height: calc(100vh - 191px -48px);
    }
    .ant-tabs-tab-active,.ant-tabs-tab{
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    .ant-tabs-bar{
        margin: 0 !important;
        
    }
    .ant-tabs-tab{
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        margin-right: 10px !important;
        line-height: 20px !important;
        // border-bottom: 1px solid #e8e8e8 !important;
    }
    .ant-tabs-tab-active{
        background-color: #5ca3e5 !important;
        border-color: #5ca3e5 !important;
        color: #fff !important;
    }
}
</style>